/**
*@Author: meihang
*@Date: 2024/6/4
*@Description: 内部供应商查询
*/
<template>
  <div class="engineeringSourcing">
    <div class="myFixed">
      <PageTitle
        :goBack="false"
        title="内部供应商查询"
        :border="false"
        v-if="isFirstLevel"
        class="myFixed1"
      />
      <div v-else>
        <PlugTitle
          :goBack="true"
          title="供应商详情"
          :border="true"
          :back-type="false"
          @go-back="hadleEngineering"
        />
      </div>
<!--      <a-tabs v-model:activeKey="activeKey">-->
<!--        <a-tab-pane :key="1" tab="工程服务供应商查询">-->
<!--          <iframe-->
<!--            id="companyIframe"-->
<!--            :class="isFirstLevel ? 'iframeCombined' : 'iframeDetail'"-->
<!--            width="100%"-->
<!--            :src="iframeUrl"-->
<!--          ></iframe>-->
<!--        </a-tab-pane>-->
<!--        <a-tab-pane :key="2" tab="已合作供应商查询" />-->
<!--      </a-tabs>-->
    </div>
    <div v-show="activeKey === 2" class="main">
      <div v-show="isFirstLevel">
        <div class="myCardCss" style="width: 100%">
          <a-form
            class="myForm1"
            :model="formData"
            :label-col="{ span: 2 }"
            :wrapper-col="14"
            style="margin-top: 36px"
          >
            <a-form-item label="关键字">
              <a-input
                style="width: 274px; margin-left: 8px"
                placeholder="请输入"
                v-model:value="formData.keyword"
              />
              <a-radio-group name="radioGroup" v-model:value="formData.keywordType" style="margin-left: 12px">
                <a-radio :value="1">供应商名称</a-radio>
                <a-radio :value="2">项目名称</a-radio>
                <a-radio :value="3">项目公司名称</a-radio>
              </a-radio-group>
            </a-form-item>
            <a-form-item label="专业板块">
              <a-checkbox @change="changeAny1" :value="any1" :checked="checked1" name="type"
                ><span style="width: 28px; display: block">不限</span></a-checkbox
              >
              <a-checkbox-group
                @change="changeOther1"
                v-model:value="formData.professionalSection"
                :options="options1"
              />
            </a-form-item>
            <a-form-item label="项目阶段">
              <a-checkbox @change="changeAny2" :value="any2" :checked="checked2" name="type"
                ><span style="width: 28px; display: block">不限</span></a-checkbox
              >
              <a-checkbox-group
                @change="changeOther2"
                v-model:value="formData.projectPhase"
                :options="options2"
              />
            </a-form-item>
            <a-form-item label="标的物类别">
              <a-checkbox @change="changeAny3" :value="any3" :checked="checked3" name="type"
                ><span style="width: 28px; display: block">不限</span></a-checkbox
              >
              <a-checkbox-group
                @change="changeOther3"
                v-model:value="formData.targetCategory"
                :options="options3"
              />
            </a-form-item>
            <a-form-item label="计划类型">
              <a-checkbox @change="changeAny4" :value="any4" :checked="checked4" name="type"
                ><span style="width: 28px; display: block">不限</span></a-checkbox
              >
              <a-checkbox-group
                @change="changeOther4"
                v-model:value="formData.planType"
                :options="options4"
              />
            </a-form-item>
<!--            <a-form-item label="采购与招标管理机构" style="margin-bottom: 16px">-->
<!--              <a-checkbox @change="changeAny5" :value="any5" :checked="checked5" name="type"-->
<!--                ><span style="width: 28px; display: block">不限</span></a-checkbox-->
<!--              >-->
<!--              <a-checkbox-group-->
<!--                @change="changeOther5"-->
<!--                v-model:value="formData.procurementAgencyType"-->
<!--                :options="options5"-->
<!--              />-->
<!--              &lt;!&ndash; <a-checkbox-group v-model:value="formData.procurementAgencyType">-->
<!--                <a-checkbox value="不限" name="type">不限</a-checkbox>-->
<!--                <a-checkbox value="集团" name="type">集团</a-checkbox>-->
<!--                <a-checkbox value="分公司" name="type">分公司</a-checkbox>-->
<!--              </a-checkbox-group> &ndash;&gt;-->
<!--            </a-form-item>-->
            <a-form-item label="项目年份">
              <a-checkbox @change="changeAny6" :value="any6" :checked="checked6" name="type"
                ><span style="width: 28px; display: block">不限</span></a-checkbox
              >
              <a-checkbox-group
                @change="changeOther6"
                v-model:value="formData.year"
                :options="options6"
              />
            </a-form-item>
            <a-form-item label="供应商投标情况">
              <a-radio-group name="radioGroup" v-model:value="formData.winBidStatus">
                <a-radio :value="1">已中标</a-radio>
                <a-radio :value="2">参与投标</a-radio>
              </a-radio-group>
            </a-form-item>
            <a-form-item label="更多筛选">
              <a-checkbox @change="changeAny7" :value="any7" :checked="checked7" name="type"
                ><span style="width: 28px; display: block">不限</span></a-checkbox
              >
              <a-checkbox-group
                @change="changeOther7"
                v-model:value="formData.markType"
                :options="options7"
              />
              <!-- <a-checkbox-group v-model:value="formData.markType">
                <a-checkbox value="不限" name="type">不限</a-checkbox>
                <a-checkbox value="WHITE" name="type">白名单</a-checkbox>
                <a-checkbox value="FOCUS" name="type">重点关注</a-checkbox>
                <a-checkbox value="BLACK" name="type">黑名单</a-checkbox>
              </a-checkbox-group> -->
              <!--                <a-select-->
              <!--                  v-model:value="formData.type2"-->
              <!--                  placeholder="白名单"-->
              <!--                  style="width: 110px; margin-right: 12px"-->
              <!--                >-->
              <!--                  <a-select-option value="shanghai">1</a-select-option>-->
              <!--                  <a-select-option value="beijing">2</a-select-option>-->
              <!--                </a-select>-->
              <!--                <a-select-->
              <!--                  v-model:value="formData.type2"-->
              <!--                  placeholder="红名单"-->
              <!--                  style="width: 110px; margin-right: 12px"-->
              <!--                >-->
              <!--                  <a-select-option value="shanghai">1</a-select-option>-->
              <!--                  <a-select-option value="beijing">2</a-select-option>-->
              <!--                </a-select>-->
              <!--                <a-select-->
              <!--                  v-model:value="formData.type2"-->
              <!--                  placeholder="黑名单"-->
              <!--                  style="width: 110px; margin-right: 12px"-->
              <!--                >-->
              <!--                  <a-select-option value="shanghai">1</a-select-option>-->
              <!--                  <a-select-option value="beijing">2</a-select-option>-->
              <!--                </a-select>-->
            </a-form-item>
            <a-button
              class="mySearchButton"
              type="primary"
              danger
              @click="searchData"
              style="border-radius: 4px"
              >查询</a-button
            >
            <a-button @click="ressetData" style="border-radius: 4px">重置</a-button>
          </a-form>
        </div>
        <div class="myCardCss" style="width: 100%">
          <a-table
            :dataSource="dataSource"
            :columns="hzColumnsNew"
            :pagination="false"
            :bordered="true"
            :scroll="{ x: 1000, y: 600 }"
          >
            <template #index="{ index }">
              {{ (pageForm.limit - 1) * pageForm.size + index + 1 }}
            </template>
            <template #winningRate="{ record }">
              {{ record.winningRate * 100 }}%
            </template>
<!--            <template #winningBidder="{ record }">-->
<!--              <label-->
<!--                @click="toDetail(record.supplierId)"-->
<!--                style="cursor: pointer"-->
<!--                :style="{ color: record.supplierId !== '-' ? '#1473dc' : '' }"-->
<!--              >{{record.winningBidder}}</label-->
<!--              >-->
<!--            </template>-->
<!--            <template #firstChoiceBidder="{ record }">-->
<!--              <label-->
<!--                @click="toDetail(record.firstChoiceBidderCompanyId)"-->
<!--                style="cursor: pointer"-->
<!--                :style="{ color: record.firstChoiceBidderCompanyId !== '-' ? '#1473dc' : '' }"-->
<!--              >{{record.firstChoiceBidder}}</label-->
<!--              >-->
<!--            </template>-->
<!--            <template #secondChoiceBidder="{ record }">-->
<!--              <label-->
<!--                @click="toDetail(record.secondChoiceBidderCompanyId)"-->
<!--                style="cursor: pointer"-->
<!--                :style="{ color: record.secondChoiceBidderCompanyId !== '-' ? '#1473dc' : '' }"-->
<!--              >{{record.secondChoiceBidder}}</label-->
<!--              >-->
<!--            </template>-->
<!--            <template #thirdChoiceBidder="{ record }">-->
<!--              <label-->
<!--                @click="toDetail(record.thirdChoiceBidderCompanyId)"-->
<!--                style="cursor: pointer"-->
<!--                :style="{ color: record.thirdChoiceBidderCompanyId !== '-' ? '#1473dc' : '' }"-->
<!--              >{{record.thirdChoiceBidder}}</label-->
<!--              >-->
<!--            </template>-->
            <template #companyName="{ record }">
              <label
                style="color: #1473dc; cursor: pointer"
                @click="toDetail(record.companyId)"
                v-html="getCompanyName(record.companyName)"
              ></label>
            </template>
            <template #operation="{ record }">
              <a @click="openInfoProject(record)" style="color:#1473dc;margin-right: 8px">符合条件项目</a>
            </template>
          </a-table>
          <a-pagination
            size="small"
            :total="pageForm.total"
            :pageSize="pageForm.size"
            :current="pageForm.limit"
            :hideOnSinglePage="true"
            :showSizeChanger="false"
            @change="changePage"
            style="margin-top: 20px; float: right"
          />
          <div style="clear: both"></div>
        </div>
      </div>
<!--      <div v-show="!isFirstLevel">-->
<!--        <div class="myCardCss" style="padding-top: 40px">-->
<!--          <PageTitle-->
<!--            :goBack="false"-->
<!--            title="供应商标签"-->
<!--            :border="false"-->
<!--            :level="2"-->
<!--            :padding="false"-->
<!--          />-->
<!--          <a-radio-group v-model:value="tagTabs" @change="changeTagTabs">-->
<!--            <a-radio-button :value="1" style="text-align: center">供应商标签</a-radio-button>-->
<!--            <a-radio-button :value="2" style="text-align: center">历史供应商标签</a-radio-button>-->
<!--          </a-radio-group>-->
<!--          <div class="addTagBtn all-4-border" @click="openAddLabel" v-if="tagTabs === 1"-->
<!--            >添加标签</div-->
<!--          >-->
<!--          <a-table-->
<!--            :dataSource="tagList"-->
<!--            :columns="tagColumns"-->
<!--            :pagination="false"-->
<!--            style="margin-top: 8px"-->
<!--            :scroll="{ x: 1000 }"-->
<!--          >-->
<!--            <template #index="{ index }">-->
<!--              {{ index + 1 }}-->
<!--            </template>-->
<!--            <template #createUserId="{ record }">-->
<!--              {{ record.createUserId ? record.createUserId?.name : '' }}-->
<!--            </template>-->
<!--            <template #operation="{ record }">-->
<!--              &lt;!&ndash; <a-popconfirm-->
<!--                :title="'是否确定' + tagTabs === 1 ? '移除？' : '删除？'"-->
<!--                ok-text="是"-->
<!--                cancel-text="否"-->
<!--                @confirm="confirmDelByTag(record.id)"-->
<!--              >-->
<!--                <a v-if="tagTabs === 1" style="color: #1473dc">移除</a>-->
<!--                <a v-if="tagTabs === 2">删除</a>-->
<!--              </a-popconfirm> &ndash;&gt;-->
<!--              <a v-if="tagTabs === 1" style="color: #1473dc" @click="openDelBox(record.id)">移除</a>-->
<!--              <a v-if="tagTabs === 2" @click="openDelBox(record.id)">删除</a>-->
<!--            </template>-->
<!--          </a-table>-->
<!--        </div>-->
<!--        <div class="myCardCss" style="margin-top: 12px">-->
<!--          <PageTitle-->
<!--            :goBack="false"-->
<!--            title="供应商评分记录"-->
<!--            :border="false"-->
<!--            :level="2"-->
<!--            :padding="false"-->
<!--          />-->
<!--          <a-table-->
<!--            :dataSource="recordList"-->
<!--            :columns="recordColumns"-->
<!--            :pagination="false"-->
<!--            style="margin-top: 8px"-->
<!--            :scroll="{ x: 1000 }"-->
<!--          >-->
<!--            <template #index="{ index }">-->
<!--              {{ (pageFormByRecord.limit - 1) * pageFormByRecord.size + index + 1 }}-->
<!--            </template>-->
<!--            <template #createUser="{ record }">-->
<!--              {{ record.createUserId ? record.createUserId?.name : '' }}-->
<!--            </template>-->
<!--            <template #operation="{ record }">-->
<!--              <a style="color: #1473dc" @click="viewScoreResult(record)">下载查看</a>-->
<!--            </template>-->
<!--          </a-table>-->
<!--          <a-pagination-->
<!--            size="small"-->
<!--            :total="pageFormByRecord.total"-->
<!--            :pageSize="pageFormByRecord.size"-->
<!--            :current="pageFormByRecord.limit"-->
<!--            :hideOnSinglePage="true"-->
<!--            :showSizeChanger="false"-->
<!--            @change="changePageByRecord"-->
<!--            style="margin-top: 10px; float: right"-->
<!--          />-->
<!--          <div style="clear: both"></div>-->
<!--        </div>-->
<!--        <div class="myCardCss" style="margin-top: 12px">-->
<!--          <PageTitle-->
<!--            :goBack="false"-->
<!--            title="供应商合作记录"-->
<!--            :border="false"-->
<!--            :level="2"-->
<!--            :padding="false"-->
<!--          />-->
<!--          <a-table-->
<!--            :dataSource="hzList"-->
<!--            :columns="hzColumns"-->
<!--            :pagination="false"-->
<!--            style="margin-top: 8px"-->
<!--            :scroll="{ x: 1000 }"-->
<!--          >-->
<!--            <template #index="{ index }">-->
<!--              {{ index + 1 }}-->
<!--            </template>-->
<!--            <template #companyName="{ record }">-->
<!--              <label style="color: #1473dc; cursor: pointer">{{ record.companyName }}</label>-->
<!--            </template>-->
<!--          </a-table>-->
<!--          <a-pagination-->
<!--            size="small"-->
<!--            :total="pageFormByHz.total"-->
<!--            :pageSize="pageFormByHz.size"-->
<!--            :current="pageFormByHz.limit"-->
<!--            :hideOnSinglePage="true"-->
<!--            :showSizeChanger="false"-->
<!--            @change="changePageByHz"-->
<!--            style="margin-top: 10px; float: right"-->
<!--          />-->
<!--          <div style="clear: both"></div>-->
<!--        </div>-->
<!--      </div>-->
    </div>
    <a-modal
      v-model:visible="isShowAddLabel"
      :maskClosable="false"
      :width="420"
      :centered="true"
      okText="确认添加"
      title="添加标签"
      @ok="saveLabelData"
      :destroyOnClose="true"
    >
      <a-form
        ref="formRef"
        :model="addLabelForm"
        :label-col="{ span: 8 }"
        :wrapper-col="12"
        style="margin-top: 16px"
      >
        <a-form-item
          name="name"
          label="标签名称"
          :rules="[{ required: true, message: t('请输入标签名称') }]"
        >
          <a-input
            v-model:value="addLabelForm.name"
            placeholder="请输入标签名称"
            style="width: 240px"
          />
        </a-form-item>
        <a-form-item label="添加依据">
          <a-textarea
            v-model:value="addLabelForm.description"
            placeholder="请输入添加依据"
            :rows="4"
            style="width: 240px"
          />
        </a-form-item>
      </a-form>
    </a-modal>
    <DeleteBox
      :is-show="isShowDelBox"
      :ok-text="'是'"
      :cancel-text="'否'"
      :prompt-text="`是否确定${tagTabs == 1 ? '移除？' : '删除？'}`"
      @ok="returnOk"
      @cancel="isShowDelBox = false"
    />
    <a-modal v-model:visible="isShowDelBox1" title="提示" @ok="handleOk">
      <div style="padding: 20px">确定删除此项合作数据吗？</div>
    </a-modal>
    <!-- 评分结果弹窗 -->
    <score-result-dialog
      v-model:open-status="scoreResultDialog"
      @ok="scoreResultOk"
      @update:open-status="scoreResultClose"
      :pdf-url="pdfUrl"
    />
    <a-modal v-model:visible="isShowProjectDetails" title="符合条件项目" :footer="null" width="90%">
      <a-table
        :dataSource="projectDetailsList"
        :columns="hzColumns"
        :pagination="false"
        :scroll="{ x: 1000, y: 600 }"
      >
        <template #index="{ index }">
          {{ (pageFormByProjectList.limit - 1) * pageFormByProjectList.size + index + 1 }}
        </template>
<!--        <template #companyName="{ record }">-->
<!--          <label-->
<!--            style="color: #1473dc; cursor: pointer"-->
<!--            @click="toDetail(record.companyId)"-->
<!--            v-html="getCompanyName(record.companyName)"-->
<!--          ></label>-->
<!--        </template>-->
        <template #operation="{ record }">
          <a @click="openInfoBox(record)" style="color:#1473dc;margin-right: 8px">详情</a>
        </template>
      </a-table>
      <a-pagination
        size="small"
        :total="pageFormByProjectList.total"
        :pageSize="pageFormByProjectList.size"
        :current="pageFormByProjectList.limit"
        :hideOnSinglePage="true"
        :showSizeChanger="false"
        @change="changePageByProjectList"
        style="margin-top: 20px; float: right"
      />
      <div style="clear: both"></div>
    </a-modal>
    <a-modal v-model:visible="isShowInfo" title="项目采购台账详情" :footer="null" width="70%">
      <page-title title="基本信息"></page-title>
      <div class="row" style="margin-top: 20px">
        <div class="col name firstCol" title="中标人">中标人</div>
        <div class="col value firstCol" :title="infoForm.winningBidder">{{infoForm.winningBidder}}</div>
        <div class="col name firstCol" title="合同名称">合同名称</div>
        <div class="col value firstCol" :title="infoForm.planName">{{infoForm.planName}}</div>
      </div>
      <div class="row">
        <div class="col name" title="项目公司">项目公司</div>
        <div class="col value" :title="infoForm.companyName">{{infoForm.companyName}}</div>
        <div class="col name" title="年份">年份</div>
        <div class="col value" :title="infoForm.year">{{infoForm.year}}</div>
      </div>
      <div class="row">
        <div class="col name" title="专业板块">专业板块</div>
        <div class="col value" :title="infoForm.professionalSection">{{infoForm.professionalSection}}</div>
        <div class="col name" title="合同类型">合同类型</div>
        <div class="col value" :title="infoForm.planType">{{infoForm.planType}}</div>
      </div>
      <div class="row">
        <div class="col name" title="是否为供应商短名单采购">是否为供应商短名单采购</div>
        <div class="col value" :title="infoForm.onSupplierShortlist">{{infoForm.onSupplierShortlist}}</div>
        <div class="col name" title="评审方式">评审方式</div>
        <div class="col value" :title="infoForm.evaluationMethod">{{infoForm.evaluationMethod}}</div>
      </div>
      <div class="row">
        <div class="col name" title="项目阶段">项目阶段</div>
        <div class="col value" :title="infoForm.projectPhase">{{infoForm.projectPhase}}</div>
        <div class="col name" style="background: white"></div>
        <div class="col value"></div>
      </div>
      <page-title title="招标信息"></page-title>
      <div class="row" style="margin-top: 20px">
        <div class="col name firstCol" title="计划名称">计划名称</div>
        <div class="col value firstCol" :title="infoForm.planName">{{infoForm.planName}}</div>
        <div class="col name firstCol" title="采购依据（立项）">采购依据（立项）</div>
        <div class="col value firstCol" :title="infoForm.procurementBasis">{{infoForm.procurementBasis}}</div>
      </div>
      <div class="row">
        <div class="col name" title="计划类型">计划类型</div>
        <div class="col value" :title="infoForm.planType">{{infoForm.planType}}</div>
        <div class="col name" title="标包名称">标包名称</div>
        <div class="col value" :title="infoForm.packageName">{{infoForm.packageName}}</div>
      </div>
      <div class="row">
        <div class="col name" title="标的物类别">标的物类别</div>
        <div class="col value" :title="infoForm.targetCategory">{{infoForm.targetCategory}}</div>
        <div class="col name" title="概（预）算金额（万元）">概（预）算金额（万元）</div>
        <div class="col value" :title="infoForm.budgetAmount">{{infoForm.budgetAmount}}</div>
      </div>
      <div class="row">
        <div class="col name" title="采购与招标管理机构">采购与招标管理机构</div>
        <div class="col value" :title="infoForm.procurementAgencyType">{{infoForm.procurementAgencyType}}</div>
        <div class="col name" title="采购方式">采购方式</div>
        <div class="col value" :title="infoForm.procurementMethod">{{infoForm.procurementMethod}}</div>
      </div>
      <div class="row">
        <div class="col name" title="采购代理机构名称">采购代理机构名称</div>
        <div class="col value" :title="infoForm.procurementAgencyName">{{infoForm.procurementAgencyName}}</div>
        <div class="col name" title="招标（非招标）编号">招标（非招标）编号</div>
        <div class="col value" :title="infoForm.tenderNumber">{{infoForm.tenderNumber}}</div>
      </div>
      <div class="row">
        <div class="col name" title="最高限价（万元）">最高限价（万元）</div>
        <div class="col value" :title="infoForm.maximumPrice">{{infoForm.maximumPrice}}</div>
        <div class="col name" title="实际开标/询价/竞价/谈判时间">实际开标/询价/竞价/谈判时间</div>
        <div class="col value" :title="infoForm.bidOpeningDate">{{infoForm.bidOpeningDate}}</div>
      </div>
      <div class="row">
        <div class="col name" title="二次挂网时间">二次挂网时间</div>
        <div class="col value" :title="infoForm.secondPostingDate">{{infoForm.secondPostingDate}}</div>
        <div class="col name" title="实际开标/询价/竞价/谈判时间">实际开标/询价/竞价/谈判时间</div>
        <div class="col value" :title="infoForm.bidOpeningDate2">{{infoForm.bidOpeningDate2}}</div>
      </div>
      <div class="row">
        <div class="col name" title="三次挂网时间">三次挂网时间</div>
        <div class="col value" :title="infoForm.thirdPostingDate">{{infoForm.thirdPostingDate}}</div>
        <div class="col name" title="实际开标/询价/竞价/谈判时间">实际开标/询价/竞价/谈判时间</div>
        <div class="col value" :title="infoForm.bidOpeningDate3">{{infoForm.bidOpeningDate3}}</div>
      </div>
      <page-title title="中标信息"></page-title>
      <div class="row" style="margin-top: 20px">
        <div class="col name firstCol" title="首选中标人">首选中标人</div>
        <div class="col value firstCol" :title="infoForm.firstChoiceBidder">{{infoForm.firstChoiceBidder}}</div>
        <div class="col name firstCol" title="备选中标人">备选中标人</div>
        <div class="col value firstCol" :title="infoForm.secondChoiceBidder">{{infoForm.secondChoiceBidder}}</div>
      </div>
      <div class="row">
        <div class="col name" title="排序第三候选人（如果有）">排序第三候选人（如果有）</div>
        <div class="col value" :title="infoForm.thirdChoiceBidder">{{infoForm.thirdChoiceBidder}}</div>
        <div class="col name" title="定标时间">定标时间</div>
        <div class="col value" :title="infoForm.awardDate">{{infoForm.awardDate}}</div>
      </div>
      <div class="row">
        <div class="col name" title="定标会议">定标会议</div>
        <div class="col value" :title="infoForm.awardMeeting">{{infoForm.awardMeeting}}</div>
        <div class="col name" title="是否有异议或投诉">是否有异议或投诉</div>
        <div class="col value" :title="infoForm.objectionsOrComplaints">{{infoForm.objectionsOrComplaints}}</div>
      </div>
      <div class="row">
        <div class="col name" title="中标人">中标人</div>
        <div class="col value" :title="infoForm.winningBidder">{{infoForm.winningBidder}}</div>
        <div class="col name" title="中标通知书下发时间">中标通知书下发时间</div>
        <div class="col value" :title="infoForm.awardNotificationDate">{{infoForm.awardNotificationDate}}</div>
      </div>
      <div class="row">
        <div class="col name" title="中标/中选金额（万元）">中标/中选金额（万元）</div>
        <div class="col value" :title="infoForm.winningAmount">{{infoForm.winningAmount}}</div>
        <div class="col name" title="是否招标转谈判采购">是否招标转谈判采购</div>
        <div class="col value" :title="infoForm.biddingToNegotiation">{{infoForm.biddingToNegotiation}}</div>
      </div>
      <page-title title="合同信息"></page-title>
      <div class="row" style="margin-top: 20px">
        <div class="col name firstCol" title="合同编号">合同编号</div>
        <div class="col value firstCol" :title="infoForm.contractNumber">{{infoForm.contractNumber}}</div>
        <div class="col name firstCol" title="合同签订时间">合同签订时间</div>
        <div class="col value firstCol" :title="infoForm.contractSigningDate">{{infoForm.contractSigningDate}}</div>
      </div>
      <div class="row">
        <div class="col name" title="工期（服务期）起止时间">工期（服务期）起止时间</div>
        <div class="col value" :title="infoForm.projectPeriodStartDate">{{infoForm.projectPeriodStartDate}}</div>
        <div class="col name" title="合同价格（万元）">合同价格（万元）</div>
        <div class="col value" :title="infoForm.contractPrice">{{infoForm.contractPrice}}</div>
      </div>
      <div class="row">
        <div class="col name" title="其中备用金（万元）">其中备用金（万元）</div>
        <div class="col value" :title="infoForm.contingencyFund">{{infoForm.contingencyFund}}</div>
        <div class="col name" title="合同变更金额（万元）">合同变更金额（万元）</div>
        <div class="col value" :title="infoForm.contractAmendmentAmount">{{infoForm.contractAmendmentAmount}}</div>
      </div>
      <div class="row">
        <div class="col name" title="合同结算金额（万元）">合同结算金额（万元）</div>
        <div class="col value" :title="infoForm.contractSettlementAmount">{{infoForm.contractSettlementAmount}}</div>
        <div class="col name" title="合同是否履行完成">合同是否履行完成</div>
        <div class="col value" :title="infoForm.contractCompletion">{{infoForm.contractCompletion}}</div>
      </div>
      <div class="row">
        <div class="col name" title="合同会签发起时间">合同会签发起时间</div>
        <div class="col value" :title="infoForm.contractInitiationDate">{{infoForm.contractInitiationDate}}</div>
        <div class="col name" title="合同经办人员">合同经办人员</div>
        <div class="col value" :title="infoForm.contractHandler">{{infoForm.contractHandler}}</div>
      </div>
      <div class="row" style="padding-bottom: 20px">
        <div class="col name" title="单一来源理由及依据">单一来源理由及依据</div>
        <div class="col value" :title="infoForm.singleSourceReason">{{infoForm.singleSourceReason}}</div>
        <div class="col name" style="background: white"></div>
        <div class="col value"></div>
      </div>
    </a-modal>
    <SupplierDetails v-if="!isFirstLevel" :company-id="nowCompanyId" @go-back="goBack" />
  </div>
</template>
<script lang="ts" setup>
  import DeleteBox from '/@/components/DeleteBox/index.vue';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { onMounted, onUnmounted, ref } from 'vue';
  import PageTitle from '/@/components/PageTitle/index.vue';
  import PlugTitle from '/@/components/PageTitle/plugTitle.vue';
  import { useRoute } from 'vue-router';
  import { getCompanyId, getCompanyInfoUrl, getProjectUrl } from '/@/api/sourcingBigData';
  import {deleteTz, getProjectLedger, getCompanyLedgerByNb} from '/@/api/supplierManage';
  import {
    addModel,
    getScoreList,
    downloadRecordPdfApi,
    exportRecord,
  } from '/@/api/supplierRating';
  import {
    addLabel,
    delLabel,
    getLabelHistoryList,
    getLabelList,
    removeLabel,
  } from '/@/api/labelTag';
  import { message } from 'ant-design-vue';
  import { getPlugData, formatCompanyId } from '/@/utils/encodeStr';
  import { steerScroll } from '/@/utils/jskplug';
  import { getDicDetailList } from '/@/api/system/dic';
  import { useRouter } from 'vue-router';
  import ScoreResultDialog from '/@/views/supplierRating/ratingList/components/ScoreResultDialog.vue';
  import SupplierDetails from "/@/components/SupplierDetails/index.vue";
  const Router = useRouter();
  const { t } = useI18n();
  const formRef = ref(null);
  onMounted(() => {
    // window.addEventListener(
    //   'message',
    //   function (e) {
    //     let detail = e.data;
    //     // console.log(e,"e.datae.data")
    //     // if (detail.currentPath) {
    //     //   let company = detail.currentPath.indexOf('/company/');
    //     //   if (company > -1) {
    //     //     let eId = detail.currentPath.slice(9, detail.currentPath.length - 1);
    //     //     setCompanyId(eId);
    //     //   }
    //     //   isFirstLevel.value = false;
    //     // }
    //   },
    //   false,
    // );
  });
  // onBeforeDestroy(() => {
  //
  // })
  onUnmounted(() => {
    // 监听滚动（iframe的id、页面排除iframe后页面剩下高度[例:80]、增加监听[不传就是移除监听]、父级id[不带默认就是铺满整个页面]]）
    // steerScroll(
    //   'companyIframe',
    //   navigation,
    //   footHeight,
    //   '',
    //   '',
    //   '',
    //   plugData,
    //   this,
    //   '会员',
    //   isFirstLevel.value,
    // );
  });
  let isShowDelBox = ref(false);
  let delId = '';
  function openDelBox(id: string) {
    isShowDelBox.value = true;
    delId = id;
  }
  function returnOk() {
    isShowDelBox.value = false;
    confirmDelByTag(delId);
  }
  const route = useRoute();
  let activeKey = ref(2);
  let companyId = '';
  let footHeight = 0;
  let navigation = { isFixed: true, fixedHeight: 0, totalHeight: 0 }; // iframe之外页面顶部对象，ifFixed:是否浮动；fixedHeight：浮动对象高度；totalHeight：顶部整体高度
  let plugData = { domain: '', param: '' }; // 插件相关信息
  let isFirstLevel = ref(true); // 是否是第一层级
  let pageForm = ref({
    size: 50,
    limit: 1,
    total: 0,
  });
  // 返回组合查
  function hadleEngineering() {
    getCompanyUrl();
    getData();
    isFirstLevel.value = true;
  }
  function backList() {
    isFirstLevel.value = true;
    Router.back();
  }
  function changePage(val) {
    pageForm.value.limit = val;
    // todo
    getData();
  }
  let formData = ref({
    keyword: '',
    keywordType: 1,
    projectPhase: [],
    planType: [],
    professionalSection: [],
    targetCategory: [],
    year: [],
    procurementAgencyType: [],
    markType: [],
    type3: '',
    winBidStatus: null, // 投标情况
  });

  let checked1 = ref(false);
  let any1 = ref('');
  let options1 = ref(['水电', '科技研发', '信息化', '光伏', '风电', '办公综合', '其他']);
  // let options1 = ref(['科技研发', '生产运维', '水电', '信息化', '科研', '其他']);
  let checked2 = ref(false);
  let any2 = ref('');
  let options2 = ref([
    // '采购已完成',
    // '基建',
    // '科技研发',
    // '前期',
    // '生产',
    // '生产运维',
    '项目前期',
    '基建',
    '生产检修技改运维',
    '其他',
  ]);
  let checked3 = ref(false);
  let any3 = ref('');
  let options3 = ref([
    '物资类',
    '工程类',
    '服务类',
  ]);
  let checked4 = ref(false);
  let any4 = ref('');
  let options4 = ref([
    '常规计划',
    '紧急采购计划',
    '零星采购计划',
    // '线下补协',
    // '线下续签',
    '直接采购计划',
    '框架采购计划'
    // '直接签订',
  ]);
  let checked5 = ref(false);
  let any5 = ref('');
  let options5 = ref(['集团', '分公司']);

  let checked6 = ref(false);
  let any6 = ref('');
  let options6 = ref(['2019年', '2020年', '2021年', '2022年', '2023年', '2024年']);
  let checked7 = ref(false);
  let any7 = ref('');
  let options7 = ref(['白名单', '重点关注', '黑名单']);
  let checked8 = ref(false);
  let any8 = ref('');
  let options8 = ref(['已中标', '参与投标']);

  const changeAny1 = () => {
    checked1.value = !checked1.value;
    formData.value.professionalSection = [];
  };
  const changeOther1 = () => {
    checked1.value = false;
  };
  const changeAny2 = () => {
    checked2.value = !checked2.value;
    formData.value.projectPhase = [];
  };
  const changeOther2 = () => {
    checked2.value = false;
  };
  const changeAny3 = () => {
    checked3.value = !checked3.value;
    formData.value.targetCategory = [];
  };
  const changeOther3 = () => {
    checked3.value = false;
  };
  const changeAny4 = () => {
    checked4.value = !checked4.value;
    formData.value.planType = [];
  };
  const changeOther4 = () => {
    checked4.value = false;
  };
  const changeAny5 = () => {
    checked5.value = !checked5.value;
    formData.value.procurementAgencyType = [];
  };
  const changeOther5 = () => {
    checked5.value = false;
  };
  const changeAny6 = () => {
    checked6.value = !checked6.value;
    formData.value.year = [];
  };
  const changeOther6 = () => {
    checked6.value = false;
  };
  const changeAny7 = () => {
    checked7.value = !checked7.value;
    formData.value.markType = [];
  };
  const changeOther7 = () => {
    checked7.value = false;
  };
  const changeAny8 = () => {
    checked8.value = !checked6.value;
    formData.value.tbqk = [];
  };
  const changeOther8 = () => {
    checked8.value = false;
  };
  let dataSource = ref([]);
  let nowCompanyId = ref('')
  if (route?.query?.companyId) {
    companyId = route?.query?.companyId;
    // isFirstLevel.value = false; // 顶部搜索直接进入详情页面
    // getUrl();
    // getDataByTag();
    // getDataByRecord();
    // getDataByHz();
    toDetail(route.query.companyId)
    getCompanyUrl();
    getData();
  } else {
    getCompanyUrl();
    getData();
  }
  function changeMyTab(index: number) {}
  let iframeUrl = ref('');
  async function setCompanyId(mark) {
    if (mark) {
      const res = await getCompanyId({ mark });
      if (res != companyId) {
        companyId = res;
        getDataByTag();
        getDataByRecord();
        getDataByHz();
      }
    }
  }
  async function getUrl() {
    let queryData = {
      companyId: companyId,
    };
    const res = await getCompanyInfoUrl(queryData);
    plugData = getPlugData(res, '/company/');
    // iframeId: iframe的id；navigation:页面排除iframe后剩下的顶部高度；footHeight: 页面排除iframe后剩下的底部高度；state:监听or移除监听；parentId: 父级id[不带默认就是铺满整个页面]];parent:父级;plugData:插件相关url信息;_this:指向当前实例（可忽略）;serviceHotline:开通会员类型
    steerScroll('companyIframe', navigation, footHeight, true, '', '', plugData, this, '会员');
    const url = formatCompanyId(res);
    iframeUrl.value = url;
  }
  async function getCompanyUrl() {
    const res = await getProjectUrl();
    plugData = getPlugData(res, '/search/combined');
    // iframeId: iframe的id；navigation:页面排除iframe后剩下的顶部高度；footHeight: 页面排除iframe后剩下的底部高度；state:监听or移除监听；parentId: 父级id[不带默认就是铺满整个页面]];parent:父级;plugData:插件相关url信息;_this:指向当前实例（可忽略）;serviceHotline:开通会员类型
    steerScroll('companyIframe', navigation, footHeight, true, '', '', plugData, this, '会员');
    iframeUrl.value = res;
  }
  let pageFormByTag = ref({
    size: 10,
    limit: 1,
    total: 0,
  });
  function changePageByTag(val) {
    pageFormByTag.value.limit = val;
    // todo
    getDataByTag();
  }

  let pageFormByRecord = ref({
    size: 10,
    limit: 1,
    total: 0,
  });
  function changePageByRecord(val) {
    pageFormByRecord.value.limit = val;
    // todo
    getDataByRecord();
  }

  let pageFormByHz = ref({
    size: 10,
    limit: 1,
    total: 0,
  });
  function changePageByHz(val) {
    pageFormByHz.value.limit = val;
    // todo
    getDataByHz();
  }

  let tagTabs = ref(1); // 1:供应商标签 2:历史供应商标签
  let tagList = ref([]); // 标签列表
  let recordList = ref([]); // 评分记录列表
  let hzList = ref([]); // 合作记录列表
  let tagColumns = ref([
    {
      title: '序号',
      align: 'center',
      slots: { customRender: 'index' },
    },
    {
      title: '标签',
      dataIndex: 'name',
      key: 'name',
      align: 'center',
    },
    {
      title: '添加人',
      dataIndex: 'createUserId',
      key: 'createUserId',
      align: 'center',
      slots: { customRender: 'createUserId' },
    },
    {
      title: '添加依据',
      dataIndex: 'description',
      key: 'description',
      align: 'center',
    },
    {
      title: '添加时间',
      dataIndex: 'createDate',
      key: 'createDate',
      align: 'center',
    },
    {
      title: '操作',
      dataIndex: 'operation',
      key: 'operation',
      slots: { customRender: 'operation' },
      align: 'center',
    },
  ]);
  let recordColumns = ref([
    {
      title: '序号',
      align: 'center',
      slots: { customRender: 'index' },
    },
    {
      title: '得分',
      dataIndex: 'score',
      key: 'score',
      align: 'center',
    },
    {
      title: '评分时间',
      dataIndex: 'createDate',
      key: 'createDate',
      align: 'center',
    },
    {
      title: '评分模型',
      dataIndex: 'modelName',
      key: 'modelName',
      align: 'center',
    },
    {
      title: '操作',
      dataIndex: 'operation',
      key: 'operation',
      slots: { customRender: 'operation' },
      align: 'center',
    },
  ]);
  let hzColumns = ref([
    {
      title: '序号',
      align: 'center',
      width: '50px',
      fixed: true,
      slots: { customRender: 'index' },
    },
    {
      title: '计划名称',
      dataIndex: 'planName',
      key: 'planName',
      align: 'center',
      fixed: true,
      width: '300px',
    },
    {
      title: '中标单位',
      dataIndex: 'winningBidder',
      key: 'winningBidder',
      align: 'center',
      width: '300px',
      slots: { customRender: 'winningBidder' },
    },
    {
      title: '项目公司',
      dataIndex: 'companyName',
      key: 'companyName',
      align: 'center',
      width: '200px',
    },
    {
      title: '中标/中选金额（万元）',
      dataIndex: 'winningAmount',
      key: 'winningAmount',
      align: 'center',
      width: '200px',
    },
    {
      title: '年份',
      dataIndex: 'year',
      key: 'year',
      align: 'center',
      width: '200px',
    },
    {
      title: '专业板块',
      dataIndex: 'professionalSection',
      key: 'professionalSection',
      align: 'center',
      width: '200px',
    },
    {
      title: '合同类型',
      dataIndex: 'planType',
      key: 'planType',
      align: 'center',
      width: '200px',
    },
    {
      title: '是否为供应商短名单采购',
      dataIndex: 'onSupplierShortlist',
      key: 'onSupplierShortlist',
      align: 'center',
      width: '200px',
    },
    {
      title: '操作',
      dataIndex: 'operation',
      key: 'operation',
      width: '160px',
      slots: { customRender: 'operation' },
      align: 'center',
      fixed: 'right',
    },
    // {
    //   title: '采购依据（立项）',
    //   dataIndex: 'procurementBasis',
    //   key: 'procurementBasis',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '标包名称',
    //   dataIndex: 'packageName',
    //   key: 'packageName',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '标的物类别',
    //   dataIndex: 'targetCategory',
    //   key: 'targetCategory',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '概（预）算金额（万元）',
    //   dataIndex: 'budgetAmount',
    //   key: 'budgetAmount',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '采购与招标管理机构',
    //   dataIndex: 'procurementAgencyType',
    //   key: 'procurementAgencyType',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '采购方式',
    //   dataIndex: 'procurementMethod',
    //   key: 'procurementMethod',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '是否为供应商短名单采购',
    //   dataIndex: 'onSupplierShortlist',
    //   key: 'onSupplierShortlist',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '采购代理机构名称',
    //   dataIndex: 'procurementAgencyName',
    //   key: 'procurementAgencyName',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '招标（非招标）编号',
    //   dataIndex: 'tenderNumber',
    //   key: 'tenderNumber',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '实际开标/询价/竞价/谈判时间',
    //   dataIndex: 'bidOpeningDate',
    //   key: 'bidOpeningDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '二次挂网时间',
    //   dataIndex: 'secondPostingDate',
    //   key: 'secondPostingDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '实际开标/询价/竞价/谈判时间',
    //   dataIndex: 'bidOpeningDate',
    //   key: 'bidOpeningDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '三次挂网时间',
    //   dataIndex: 'thirdPostingDate',
    //   key: 'thirdPostingDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '实际开标/询价/竞价/谈判时间',
    //   dataIndex: 'bidOpeningDate',
    //   key: 'bidOpeningDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '最高限价（万元）',
    //   dataIndex: 'maximumPrice',
    //   key: 'maximumPrice',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '首选中标人',
    //   dataIndex: 'firstChoiceBidder',
    //   key: 'firstChoiceBidder',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '备选中标人',
    //   dataIndex: 'secondChoiceBidder',
    //   key: 'secondChoiceBidder',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '排序第三候选人（如有）',
    //   dataIndex: 'thirdChoiceBidder',
    //   key: 'thirdChoiceBidder',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '定标时间',
    //   dataIndex: 'awardDate',
    //   key: 'awardDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '定标会议',
    //   dataIndex: 'awardMeeting',
    //   key: 'awardMeeting',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '是否有异议或投诉',
    //   dataIndex: 'objectionsOrComplaints',
    //   key: 'objectionsOrComplaints',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '中标通知书下发时间',
    //   dataIndex: 'awardNotificationDate',
    //   key: 'awardNotificationDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '中标/中选金额（万元）',
    //   dataIndex: 'winningAmount',
    //   key: 'winningAmount',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '中标人',
    //   dataIndex: 'winningBidder',
    //   key: 'winningBidder',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '是否招标转谈判采购',
    //   dataIndex: 'biddingToNegotiation',
    //   key: 'biddingToNegotiation',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同编号',
    //   dataIndex: 'contractNumber',
    //   key: 'contractNumber',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同签订时间',
    //   dataIndex: 'contractSigningDate',
    //   key: 'contractSigningDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '工期（服务期）起止时间',
    //   dataIndex: 'projectPeriodStartDate',
    //   key: 'projectPeriodStartDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同价格（万元）',
    //   dataIndex: 'contractPrice',
    //   key: 'contractPrice',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '其中备用金（万元）',
    //   dataIndex: 'contingencyFund',
    //   key: 'contingencyFund',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同变更金额（万元）',
    //   dataIndex: 'contractAmendmentAmount',
    //   key: 'contractAmendmentAmount',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同结算金额（万元）',
    //   dataIndex: 'contractSettlementAmount',
    //   key: 'contractSettlementAmount',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同是否履行完成',
    //   dataIndex: 'contractCompletion',
    //   key: 'contractCompletion',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同会签发起时间',
    //   dataIndex: 'contractInitiationDate',
    //   key: 'contractInitiationDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '合同经办人员',
    //   dataIndex: 'contractHandler',
    //   key: 'contractHandler',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '工期（服务期）起止时间',
    //   dataIndex: 'projectPeriodStartDate',
    //   key: 'projectPeriodStartDate',
    //   align: 'center',
    //   width: '200px',
    // },
    // {
    //   title: '单一来源理由及依据',
    //   dataIndex: 'singleSourceReason',
    //   key: 'singleSourceReason',
    //   align: 'center',
    //   width: '200px',
    // },
  ]);
  let hzColumnsNew = ref([
    {
      title: '序号',
      align: 'left',
      fixed: true,
      width: '70px',
      slots: { customRender: 'index' },
    },
    {
      title: '供应商名称',
      dataIndex: 'companyName',
      key: 'companyName',
      align: 'left',
      width: '450px',
      fixed: true,
      slots: { customRender: 'companyName' },
    },
    {
      title: '最近一次合作时间',
      dataIndex: 'lastCooperationDate',
      key: 'lastCooperationDate',
      align: 'left',
      width: '200px',
      fixed: true,
    },
    {
      title: '合作总金额(万元)',
      dataIndex: 'contractAmount',
      key: 'contractAmount',
      align: 'left',
      width: '150px',
    },
    {
      title: '招投标次数',
      dataIndex: 'bidderCount',
      key: 'bidderCount',
      align: 'left',
      width: '100px',
    },
    {
      title: '中标次数',
      dataIndex: 'totalCooperationCount',
      key: 'totalCooperationCount',
      align: 'left',
      width: '100px',
    },
    {
      title: '中标率',
      dataIndex: 'winningRate',
      key: 'winningRate',
      slots: { customRender: 'winningRate' },
      align: 'left',
      width: '100px',
    },
    {
      title: '操作',
      dataIndex: 'operation',
      key: 'operation',
      width: '160px',
      slots: { customRender: 'operation' },
      align: 'center',
      fixed: 'right',
    },
  ]);
  async function getDataByTag() {
    let queryData = {
      companyId: companyId,
    };
    const res = await getLabelList(queryData);
    tagList.value = res;
  }
  // 历史标签列表
  async function getDataByHistoryTag() {
    let queryData = {
      companyId: companyId,
    };
    const res = await getLabelHistoryList(queryData);
    tagList.value = res;
  }
  async function getDataByRecord() {
    let queryData = {
      companyIds: companyId,
      limit: pageFormByRecord.value.limit,
      size: pageFormByRecord.value.size,
    };
    const res = await getScoreList(queryData);
    recordList.value = res.list.map((item) => {
      const obj = { ...item };
      for (let key in obj) {
        if (obj[key] === null || obj[key] === undefined) {
          obj[key] = '-';
        }
      }
      return obj;
    });
    pageFormByRecord.value.total = res.total;
  }
  async function getDataByHz() {
    let queryData = {
      supplierId: companyId,
      limit: pageFormByHz.value.limit,
      size: pageFormByHz.value.size,
    };
    const res = await getProjectLedger(queryData);
    hzList.value = res.list;
    pageFormByHz.value.total = res.total;
  }
  function searchData() {
    pageForm.value.limit = 1;
    getData();
  }
  function ressetData() {
    checked1.value = false;
    checked2.value = false;
    checked3.value = false;
    checked4.value = false;
    checked5.value = false;
    checked6.value = false;
    checked7.value = false;
    formData.value = {
      keyword: '',
      keywordType: 1,
      projectPhase: [],
      planType: [],
      professionalSection: [],
      targetCategory: [],
      year: [],
      procurementAgencyType: [],
      markType: [],
      type3: '',
      winBidStatus: null, // 投标情况
    };
  }
  async function getData() {
    const targetCategory = formData.value.targetCategory.filter((item) => item === '不限').length
      ? []
      : formData.value.targetCategory;
    const projectPhase = formData.value.projectPhase.filter((item) => item === '不限').length
      ? []
      : formData.value.projectPhase;
    const planType = formData.value.planType.filter((item) => item === '不限').length
      ? []
      : formData.value.planType;
    const procurementAgencyType = formData.value.procurementAgencyType.filter(
      (item) => item === '不限',
    ).length
      ? []
      : formData.value.procurementAgencyType;
    const professionalSection = formData.value.professionalSection.filter((item) => item === '不限')
      .length
      ? []
      : formData.value.professionalSection;
    const year = formData.value.year.filter((item) => item === '不限').length
      ? []
      : formData.value.year.map((item) => item.substring(0, item.length - 1));
    const markType = formData.value.markType.filter((item) => item === '不限').length
      ? []
      : formData.value.markType.map((item) =>
          item === '白名单' ? 'WHITE' : item === '黑名单' ? 'BLACK' : 'FOCUS',
        );
    let queryData = {
      targetCategory: targetCategory.toString(),
      projectPhase: projectPhase.toString(),
      planType: planType.toString(),
      procurementAgencyType: procurementAgencyType.toString(),
      professionalSection: professionalSection.toString(),
      markType: markType.toString(),
      year: year.toString(),
      keyword: formData.value.keyword,
      keywordType: formData.value.keywordType,
      winBidStatus: formData.value.winBidStatus,
      limit: pageForm.value.limit,
      size: pageForm.value.size
    };
    const res = await getCompanyLedgerByNb(queryData);
    dataSource.value = res.list.map((item) => {
      const obj = { ...item };
      for (let key in obj) {
        if (obj[key] === null || obj[key] === undefined) {
          obj[key] = '-';
        }
      }
      obj.key = obj.id;
      return obj;
    });
    pageForm.value.total = res.total;
  }
  const getCompanyName = (companyName) => {
    if (formData.value.keyword.trim()) {
      return companyName.replaceAll(
        formData.value.keyword.trim(),
        `<span style="color: red;">${formData.value.keyword.trim()}</span>`,
      );
    }
    return companyName;
  };
  function toDetail(id: string) {
    if (id === '-') {
      return message.warning('未查到该公司详情');
    }
    companyId = id;
    nowCompanyId.value = id
    isFirstLevel.value = false;
    // getUrl();
    // getDataByTag();
    // getDataByRecord();
    // getDataByHz();
  }
  function changeTagTabs() {
    if (tagTabs.value === 1) {
      // 标签
      getDataByTag();
    } else {
      // 历史标签
      getDataByHistoryTag();
    }
  }
  async function confirmDelByTag(id: string) {
    if (tagTabs.value === 1) {
      // 移除
      await removeLabel(id);
      getDataByTag();
    } else {
      // 删除
      await delLabel(id);
      getDataByHistoryTag();
    }
  }

  // 新增模型
  let isShowAddLabel = ref(false);
  let addLabelForm = ref({
    name: '',
    description: '',
  });
  function openAddLabel() {
    isShowAddLabel.value = true;
    addLabelForm.value = {
      name: '',
      description: '',
    };
  }
  async function saveLabelData() {
    try {
      const checked = await formRef.value.validate();
      if (checked) {
        let queryData = {
          companyId: companyId,
          name: addLabelForm.value.name,
          description: addLabelForm.value.description,
        };
        const res = await addLabel(queryData);
        message.success('新增标签成功');
        isShowAddLabel.value = false;
        getDataByTag();
      }
    } finally {
    }
  }

  // 下载报告
  const downloadSingle = async (row: any) => {
    try {
      if (!row.id) return;
      const resultStream = await downloadRecordPdfApi(row.id);
      if (resultStream.data) {
        saveAs(resultStream.data, `${row.companyName}评分报告_${row.createDate}`);
      }
    } catch (error) {
      console.log(error);
    }
  };
  // 报告结果预览弹窗
  const scoreResultDialog = ref<boolean>(false);
  // 行数据缓存
  const rowTemp = ref(null);
  // 当前查看的pdf url地址
  const pdfUrl = ref<string>('');
  // 查看报告结果 先获取报告链接
  async function viewScoreResult(row: any) {
    try {
      if (!row.id) return;
      rowTemp.value = row;
      const resultStream = await downloadRecordPdfApi(row.id);
      if (resultStream.data) {
        const url = URL.createObjectURL(resultStream.data);
        pdfUrl.value = url;
        // scoreResultDialog.value = true;
        scoreResultOk()
      }
    } catch (error) {}
  }
  // 预览完成
  async function scoreResultOk() {
    await downloadSingle(rowTemp.value);
  }
  function scoreResultClose(flag) {
    scoreResultDialog.value = flag;
    rowTemp.value = null;
    URL.revokeObjectURL(pdfUrl.value);
    pdfUrl.value = '';
  }
  let isShowInfo = ref(false)
  let infoForm = ref()
  const openInfoBox = (e: any) => {
    isShowInfo.value = true
    infoForm.value = e
  }
  let isShowProjectDetails = ref(false)
  let projectDetailsList = ref([])
  let pageFormByProjectList = ref({
    size: 10,
    limit: 1,
    total: 0,
  })
  let projectDetailsBidderName = ref('')
  function changePageByProjectList(val) {
    pageFormByProjectList.value.limit = val;
    // todo
    getProjectList();
  }
  const openInfoProject = (e: any) => {
    projectDetailsBidderName.value = e.companyName
    isShowProjectDetails.value = true
    getProjectList()
  }
  const getProjectList = async () => {
    let queryData = {
      bidderName: projectDetailsBidderName.value,
      limit: pageFormByProjectList.value.limit,
      size: pageFormByProjectList.value.size,
    };
    const res = await getProjectLedger(queryData);
    projectDetailsList.value = res.list.map(item => {
      item.planName = item.planName ? item.planName : '-'
      return item
    })
    pageFormByProjectList.value.total = res.total;
  }
  // 删除
  let isShowDelBox1 = ref(false);
  let delId1 = ref(0);
  const openDelBox1 = (e: any) => {
    delId1.value = e.id;
    isShowDelBox1.value = true;
  };
  const handleOk = async () => {
    await deleteTz(delId1.value);
    isShowDelBox1.value = false;
    // getData();
  };
  function goBack() {
    isFirstLevel.value = true;
  }
</script>
<style lang="less" scoped>
  :deep(.ant-tabs) {
    min-width: 1240px;
    overflow-x: scroll;
  }
  .engineeringSourcing {
    .remarks {
      width: 100%;
      height: 36px;
      border-radius: 2px;
      background: #f5f7fa;
      line-height: 36px;
      font-size: 12px;
      padding: 0 16px;
      margin-top: 8px;
    }
    .myCard {
      border: 1px solid #e4e7ed;
      margin-top: 16px;
      .myTab {
        display: flex;
        width: 100%;
        height: 40px;
        .tabItem {
          flex: 1;
          text-align: center;
          line-height: 40px;
          background: #f5f7fa;
          cursor: pointer;
          box-sizing: border-box;
        }
        .tabItem.active {
          border-top: 2px solid #c11a20;
          background: #f9e9e9;
          color: #c11a20;
        }
      }
    }
    .myForm {
      padding-left: 68px;
    }
    .addDiv {
      display: flex;
      width: 100%;
      height: 38px;
      background: #f5f7fa;
      padding: 0 16px;
      line-height: 38px;
      margin-top: 12px;
      position: relative;
      .myAddBtn {
        width: 14px;
        height: 14px;
        border-radius: 2px;
        background: #c11a20;
        text-align: center;
        line-height: 14px;
        color: #ffffff;
        margin-top: 12px;
        margin-right: 4px;
      }
      .myRadio {
        position: absolute;
        right: 16px;
        top: 7px;
      }
    }
    .myEditBtn {
      margin-left: 8px;
      color: #c11a20;
      cursor: pointer;
    }
    .list-top {
      .list-count {
        margin-top: 5px;
      }
      display: flex;
      justify-content: space-between;
    }
    .data-list {
      .data-item {
        height: 154px;
        display: flex;
        padding: 16px 16px;
        border-bottom: 1px solid #dcdfe6;
        .company-icon {
          margin-right: 24px;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          width: 78px;
          height: 100%;
          img {
            width: 78px;
          }
        }
        .company-info {
          width: calc(100% - 102px);
          .name {
            color: #303133;
            font-size: 20px;
            font-weight: 500;
            margin-bottom: 8px;
          }
          .state {
            width: 40px;
            height: 22px;
            border-radius: 2px;
            background: #e8f7ed;
            text-align: center;
            line-height: 22px;
            font-size: 13px;
            color: #16af44;
            margin-bottom: 12px;
          }
          .info {
            display: flex;
            flex-wrap: wrap;
            .info-item {
              font-size: 13px;
              margin-right: 32px;
              margin-bottom: 8px;
              .info-name {
                color: #909399;
              }
              .info-value1 {
                color: #303133;
              }
              .info-value2 {
                color: #1473dc;
              }
            }
          }
        }
      }
    }
    .mySearchButton {
      margin-left: 196px;
      margin-right: 12px;
    }
  }
  :deep(.ant-tabs-nav) {
    margin-bottom: 0;
  }
  :deep(.ant-tabs-nav-wrap) {
    padding: 0 20px;
    background: #ffffff;
  }
  :deep(.ant-form-item) {
    margin-bottom: 8px;
  }
  .addTagBtn {
    border: 1px solid #1473dc;
    padding: 5px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #1473dc;
    float: right;
    cursor: pointer;
  }
  .iframeCombined {
    height: calc(100vh - 246px) !important;
  }
  .iframeDetail {
    height: calc(100vh - 246px) !important;
  }

  :deep(.ant-form-item-label > label) {
    height: 36px !important;
  }
  .myFixed1 {
    //position: fixed;
    width: calc(100% - 7px);
    //box-sizing: border-box;
    //top: 0px;
    z-index: 10;
  }
  .myFixed {
    position: fixed;
    z-index: 10;
    width: calc(100% - 258px);
    background: #ffffff;
  }
  .main {
    padding-top: 0px;
  }
  .row{
    width:  100%;
    padding: 0 20px;
    display: flex;
    .col{
      height: 38px;
      line-height: 38px;
      padding: 0 20px;
      border-bottom: 1px solid #dcdfe6;
    }
    .col.name{
      width:  20%;
      background: rgb(220, 238, 255);
      white-space: nowrap; /* 确保文本不换行 */
      overflow: hidden; /* 超出容器部分隐藏 */
      text-overflow: ellipsis; /* 超出部分显示省略号 */
    }
    .col.value{
      width: 30%;
      border-right: 1px solid #dcdfe6;
      white-space: nowrap; /* 确保文本不换行 */
      overflow: hidden; /* 超出容器部分隐藏 */
      text-overflow: ellipsis; /* 超出部分显示省略号 */
    }
    .col.firstCol{
      border-top: 1px solid #dcdfe6;
    }
  }
</style>
